package edu.pku.sei.transformation.mtparser;

import lpg.runtime.*;

/**
 *<b>
 *<li>Rule 31:  ExistoneExpr ::= AtomicExpr -> existone { Name | Expression }
 *</b>
 */
public class ExistoneExpr extends Ast implements IExistoneExpr
{
    private IAtomicExpr _AtomicExpr;
    private Name _Name;
    private IExpression _Expression;

    public IAtomicExpr getAtomicExpr() { return _AtomicExpr; }
    public Name getName() { return _Name; }
    public IExpression getExpression() { return _Expression; }

    public ExistoneExpr(IToken leftIToken, IToken rightIToken,
                        IAtomicExpr _AtomicExpr,
                        Name _Name,
                        IExpression _Expression)
    {
        super(leftIToken, rightIToken);

        this._AtomicExpr = _AtomicExpr;
        this._Name = _Name;
        this._Expression = _Expression;
        initialize();
    }

    public boolean equals(Object o)
    {
        if (o == this) return true;
        if (! (o instanceof ExistoneExpr)) return false;
        if (! super.equals(o)) return false;
        ExistoneExpr other = (ExistoneExpr) o;
        if (! _AtomicExpr.equals(other._AtomicExpr)) return false;
        if (! _Name.equals(other._Name)) return false;
        if (! _Expression.equals(other._Expression)) return false;
        return true;
    }

    public int hashCode()
    {
        int hash = super.hashCode();
        hash = hash * 31 + (_AtomicExpr.hashCode());
        hash = hash * 31 + (_Name.hashCode());
        hash = hash * 31 + (_Expression.hashCode());
        return hash;
    }

    public void accept(Visitor v) { v.visit(this); }
    public void accept(ArgumentVisitor v, Object o) { v.visit(this, o); }
    public Object accept(ResultVisitor v) { return v.visit(this); }
    public Object accept(ResultArgumentVisitor v, Object o) { return v.visit(this, o); }
}


